package com.pb.news.web.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * ${NAME}--BDQN_WEB_NEWS
 *
 * @author: Jovi
 * @createTime: 2018-04-11 15:38
 **/
@WebFilter(filterName = "CharacterEncodingFilter",urlPatterns = "/*")
public class CharacterEncodingFilter implements Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        chain.doFilter(req, resp);
        resp.setCharacterEncoding("utf-8");
    }

    public void init(FilterConfig config) throws ServletException {

    }

}
